package cn.com.bdqn.dao;

import cn.com.bdqn.entity.SysUser;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface SysUserDao {

    @Select("select * from sys_user where usr_name = #{usrName} and usr_password = #{usrPassword};")
    public SysUser login(SysUser sysUser);

    @Select("select * from sys_user where usr_role_id = (select role_id from sys_role where role_name = '客户经理');")
    public List<SysUser> queryManger();

    @Select("select * from sys_user where usr_id = #{usrId}")
    public SysUser queryById(SysUser sysUser);

    public List<Map> queryByLike(SysUser sysUser);

    public int updateSysUser(SysUser sysUser);

    @Delete("delete from sys_user where usr_id = #{value}")
    public int delSysUser(Long usrId);

    @Insert("insert into sys_user values\n" +
            "(default,#{usrName},#{usrPassword},#{usrRoleId},0)")
    public int addSysUser(SysUser sysUser);
}
